﻿namespace Magellan.Routing
{
    public class SegmentValueMatch
    {
        private readonly bool _success;
        private readonly object _segmentValue;
        private readonly string _failReason;

        private SegmentValueMatch(bool success, object segmentValue, string failReason)
        {
            _success = success;
            _segmentValue = segmentValue;
            _failReason = failReason;
        }

        public static SegmentValueMatch Successful()
        {
            return Successful(null);
        }

        public static SegmentValueMatch Successful(object segmentValue)
        {
            return new SegmentValueMatch(true, segmentValue, null);
        }

        public static SegmentValueMatch Failure(string failReason)
        {
            return new SegmentValueMatch(false, null, failReason);
        }

        public bool Success
        {
            get { return _success; }
        }

        public object SegmentValue
        {
            get { return _segmentValue; }
        }

        public string FailReason
        {
            get { return _failReason; }
        }
    }
}